import * as http from "@/utils/request"

/**
 * 获取全部轮播图
 * @returns Promise
 */
export function getAllCarousels() {
  return http.get('/api/admin/Carousel/GetAllCarousels');
}

/**
 * 根据ID获取一个轮播图
 * @param {number} id 轮播图ID
 * @returns Promise
 */
export function getCarouselById(id) {
  return http.get('/api/admin/Carousel/GetCarouselById', { id });
}

/**
 * 添加一张轮播图
 * @param {object} params 轮播图对象
 * @returns Promise
 */
export function addCarousel(params) {
  return http.post('/api/admin/Carousel/AddCarousel', params);
}

/**
 * 更新轮播图信息
 * @param {object} params 轮播图对象
 * @returns Promise
 */
export function updateCarousel(params) {
  return http.post('/api/admin/Carousel/UpdateCarousel', params);
}

/**
 * 删除轮播图
 * @param {number} id 轮播图ID
 * @returns Promise
 */
export function deleteCarousel(id) {
  return http.get('/api/admin/Carousel/DeleteCarousel', { id });
}

/**
 * 上传图片/视频
 * @param {FormData} formData 上传表单数据
 * @returns Promise
 */
export function uploadMedia(formData) {
  return http.post('/api/admin/Carousel/UploadMedia', formData, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });
}